package org.nlp2rdf.navigator.client;

import java.util.List;
import java.util.Set;

import org.nlp2rdf.navigator.client.common.ClassificationCountResultDTO;
import org.nlp2rdf.navigator.client.common.ClassificationResultDTO;
import org.nlp2rdf.navigator.client.common.ConceptDTO;
import org.nlp2rdf.navigator.client.common.ExampleDTO;
import org.nlp2rdf.navigator.client.common.KnowledgeBaseDescriptorDTO;
import org.nlp2rdf.navigator.client.common.LearnedConceptDTO;
import org.nlp2rdf.navigator.client.common.RelatedConceptsDTO;
import org.nlp2rdf.navigator.client.common.SearchResultDTO;
import org.nlp2rdf.navigator.client.common.StoredConceptDTO;
import org.nlp2rdf.navigator.client.common.UserDTO;
import org.nlp2rdf.navigator.client.exception.NKEConceptParseException;
import org.nlp2rdf.navigator.client.exception.NKELearningException;
import org.nlp2rdf.navigator.client.exception.NKEQueryException;
import org.nlp2rdf.navigator.client.exception.NKERuntimeException;

import com.google.gwt.user.client.rpc.RemoteService;

public interface WorkerService extends RemoteService {

	/**
	 * 
	 * @return a list of identifiers for available knowledge bases initially
	 *         "dbpedia" and "tiger"
	 * @throws NKERuntimeException
	 */
	public abstract Set<KnowledgeBaseDescriptorDTO> listAvailableKnowledgeBases() throws NKERuntimeException;

	/**
	 * for changing the whole thing, e.g. from tiger to dbpedia
	 * 
	 * @param kbId
	 * @return
	 * @throws NKERuntimeException
	 */
	public abstract KnowledgeBaseDescriptorDTO changeKnowledgeBase(String kbId) throws NKERuntimeException;

	public abstract ClassificationCountResultDTO classifyCount(String conceptInKBSyntax)
			throws NKEConceptParseException, NKEQueryException, NKERuntimeException;

	public abstract ClassificationResultDTO classify(String conceptInKBSyntax, int limit, int offset)
			throws NKEConceptParseException, NKEQueryException, NKERuntimeException;

	public LearnedConceptDTO learn(List<ExampleDTO> pos, List<ExampleDTO> neg) throws NKELearningException,
			NKEQueryException, NKERuntimeException;

	public List<LearnedConceptDTO> specialise(String conceptInKBSyntax) throws NKELearningException,
			NKEQueryException, NKERuntimeException;

	public List<LearnedConceptDTO> generalise(String conceptInKBSyntax) throws NKELearningException,
			NKEQueryException, NKERuntimeException;

	/**
	 * @param searchId
	 * @param search
	 *            A String, which will later be mapped to bif:contains
	 * @param nrOfResults
	 *            How many results are returned
	 * @return
	 * @throws NKEQueryException
	 * @throws NKERuntimeException
	 */
	public abstract SearchResultDTO search(String searchId, String search, int nrOfResults)
			throws NKEQueryException, NKERuntimeException;

	// public abstract void terminateSession();

	public abstract void saveConcept(LearnedConceptDTO dto) throws NKERuntimeException;

	public abstract RelatedConceptsDTO getRelatedConcepts(ConceptDTO lrdto)
			throws NKERuntimeException, NKEQueryException;

	public abstract void incrementHitCount(StoredConceptDTO lrdto) throws NKERuntimeException;

	// public abstract void putSessionConcept(LearningResultDTO dto);

	// public abstract List<LearningResultDTO> getSessionConcepts();

	// public abstract List<LearningResultDTO>
	// getSuperConcepts(LearningResultDTO dto);
	// public abstract List<LearningResultDTO> getSubConcepts(LearningResultDTO
	// dto);

	public abstract UserDTO login(String username, String password);

	public abstract List<StoredConceptDTO> getStoredConcepts() throws NKERuntimeException;

	// public abstract List<LearningResultDTO> getStoreConcepts();
	//
	// public abstract List<LearningResultDTO> getStoreConcepts(String sortBy);
	//
	// public abstract List<LearningResultDTO> getStoreConcepts(String property,
	// String filterValue);

}